home *** CD-ROM | disk | FTP | other *** search
- Path: news.umbc.edu!not-for-mail
- From: schlein@umbc.edu (Jonas J. Schlein)
- Newsgroups: comp.lang.c
- Subject: Re: HELP..Need to find why atan2 gives..
- Date: 2 Feb 1996 17:15:59 -0500
- Organization: University of Maryland Baltimore County
- Message-ID: <4eu2ev$ab9@umbc9.umbc.edu>
- References: <Pine.OSF.3.91.960201012731.27628B-100000@reno.WPI.EDU>
- NNTP-Posting-Host: umbc9.umbc.edu
- NNTP-Posting-User: schlein
-
- Jose Andres Giraldez <vittohue@wpi.edu> wrote:
- |> I need to find why atan2 gives a number smaller than -180 and greater
- |> than 180.
- |> ??????????
- |>
- |> /*It works on BIGWPI.wpi.edu*/
- |> #include <stdio.h>
- |> #include <float.h>
- |> #include <math.h>
- |> #include "/cs/cs1005/problems/problem2/problem2.h"
-
- We don't have problem2.h so your code can't be compiled on other machines
- unless the definitions from this file are made available.
-
- |> int main ()
- |> {
- |> int Pi=3.14159, count, n_rows, n_columns;
-
- What do you intend here? Pi is declared as an int, but 3.14159 is clearly not.
-
- [lots of code deleted]
-
- |> /*Convert theta from radians to degrees*/
- |> {
- |> for (count = 0; count<N_MEAS; count++)
- |> {
- |> degrees[count] = (double) ((theta[count] * 180)/Pi)+Pi;
-
- Obviously your value of Pi (in this case 3) is going to throw off the
- calculations.
-
- [Lots more code deleted]
-
- |> Pi=3.14159;
-
- You can do this assignment all day and get no more accurate results. Since Pi
- is an integer it simply cannot store 3.14159 as you have entered it.
-
- Can't forget 'return (0);'!
- |> }
- --
- "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
-
- Jonas J. Schlein (schlein@gl.umbc.edu)
-